#include <iostream>
#include <cstdio>
#include <algorithm>
#include <map>
#include <cstring>
#include <vector>
#include<queue>
using namespace std;
bool a[10000];
int main()
{
	int l, r;
	cin >> l >> r;
	a[1] = 1, a[0] = 1;
	for (int i = 2; i <= r; i++)
	{
		for (int j = i+i; j <= r; j = j + i)
		{
			a[j] = 1;
		}
	}
	for (int i = l; i <= r; i++)
	{
		int x = i;
		while (x)
		{
			if (a[x])
				break;
			x = x / 10;
		}
		if (x == 0)
			cout << i << endl;
	}
	return 0;
}